"""
健康检查API路由
"""
from datetime import datetime
from fastapi import APIRouter
from loguru import logger

from app.databases.schemas import HealthCheckResponse
from app.core.config import settings

router = APIRouter()


@router.get("/health", response_model=HealthCheckResponse)
async def health_check():
    """
    健康检查接口
    """
    return HealthCheckResponse(
        status="healthy",
        service=settings.APP_NAME,
        version=settings.APP_VERSION,
        timestamp=datetime.now()
    )


@router.get("/")
async def root():
    """
    根路径，返回API信息
    """
    logger.info("Root endpoint accessed")
    return {
        "message": f"{settings.APP_NAME}",
        "version": settings.APP_VERSION,
        "status": "running",
        "endpoints": {
            "health": "/health",
            "audio_pitch_shift": "/api/v1/audio/pitch-shift",
            "audio_records": "/api/v1/audio/records",
            "audio_statistics": "/api/v1/audio/statistics"
        }
    }
